package com.iraytek.rtspdemo;

import android.util.Size;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

public class ImageData implements Cloneable {
    private byte[] data;
    private int width;
    private int height;
    private long ts;

    public ImageData() {
    }

    /**
     * Fill data, from native
     *
     * @param data image data
     */
    @Keep
    public void fill(byte[] data, int width, int height) {
        this.data = data;
        this.width = width;
        this.height = height;
    }

    @NonNull
    @Override
    public ImageData clone() {
        ImageData imageData = new ImageData();
        imageData.width = width;
        imageData.height = height;
        imageData.ts = ts;
        if (data != null) {
            imageData.data = data.clone();
        }

        return imageData;
    }

    public Size getImageSize() {
        return new Size(width, height);
    }


    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public long getTs() {
        return ts;
    }

    public void setTs(long ts) {
        this.ts = ts;
    }
}
